<style>    
    #testFileInput2{
        height: 30px; width: 102px; margin-left: 128px;
    }
    #preview1, #topPhpto
        {  
            width:150px;  
            padding-left: 65px;padding-top: 15px; border-top-width: 5px;
            //height:150px;  
        }
</style>
<div class="pageContent">	
    <form method="post" action="__CONTROLLER__/edit?callbackType=closeCurrent" id="myForm" class="pageForm required-validate" onsubmit="return validateCallback(this, dialogAjaxDone)">        
        <div class="pageFormContent" layoutH="58">
            <if condition="$_sign eq 1">
                <div class="unit">
                    <label>姓名：</label>
                    <input type="text" size="25" value="" id='user' class="required"/>
                    <input type="hidden" name="accept_id"  value="" id='accept_id'/>
                    <input type="hidden" name="sign" value=""/>
                    <input type="hidden" name="is_setname" value=""/> 
                    <input type="hidden" name="section_id" value=""/>
                </div>
                <div class="unit">
                    <label>部门：</label>
                    <input type="text" size="25"  value="<{$uList.area_section}>" readonly='true' id='area_section'/>
                </div>
                <div class="unit">
                    <label>岗位：</label>
                    <input type="text" size="25"  value="<{$uList.position}>" readonly='true' id='position'/>
                </div>
                <div class="unit">
                    <label>季度：</label>
                    <select name="quarter" class='required' style="width: 101px;" id="select_1"> 
                        <option value="Q1">Q1</option>
                        <option value="Q2">Q2</option>
                        <option value="Q3">Q3</option>
                        <option value="Q4">Q4</option>
                    </select>
                </div>
            <elseif condition="$_sign eq 2"/>
                <input type="hidden" name="kpi_id" value="<{$kpi_id}>"/>
                <input type="hidden" name="db" value="KpiTasks"/>
                <input type="hidden" name='id' value="<{$vo['id']}>"/>
                <div class="unit">
                    <label>项目：</label>
                    <input type="text" size="25" name='subjects'  value="<{$vo.subjects}>" class="required"/>
                </div>
                <div class="unit">
                    <label>计划完成日期：</label>
                    <input type="text" size="25" name='completion_data'  value="<{$vo.completion_data}>" readonly='true' class="date"/>
                </div>
                <div class="unit">
                    <label>实际完成日期：</label>
                    <input type="text" size="25" name='actual_completion_data'  value="<{$vo.actual_completion_data}>" readonly='true' class="date"/>
                </div>
                <div class="unit">
                    <label>权重：</label>
                    <input type="text" size="25" name='percentage'  value="<{$vo.percentage}>" class="required"/>
                </div>
                <div class="unit">
                    <label>项目描述：</label>
                    <textarea name="modification_record" rows="5" cols="53" class="required"><{$vo.modification_record}></textarea>
                </div>
            </if>
        </div>
        <div class="formBar">
            <ul>
                <li><div class="buttonActive"><div class="buttonContent"><button type="button" id='sub'>提交</button></div></div></li>
                <li><div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div></li>
            </ul>
        </div>
    </form>
    <input type="hidden" name="is_sign" value="<{$_sign}>"/>
</div>
<script>
    $(function(){
        $('#user').blur(function(){ 
            var username=$("#user").val();
            $("#area_section").empty();
            $("#position").empty();
            $.post("__CONTROLLER__/ajaxUserName",{username:username},function(json){
                if(json==1){ 
                    $("input[name='is_setname']").val(1);
                    alert("用户不存在");                
                    return false;
                }
                if(json==2){ 
                    $("input[name='is_setname']").val(2);
                    alert("无权考核此用户");                
                    return false;
                }
                var datajson   =eval('(' + json + ')');
                var ption       =datajson.position;
                var astion      =datajson.sec;
                var id          =datajson.id;
                var section_id  =datajson.section_id;
                $("input[name='is_setname']").val('');
                $("#area_section").val(astion);
                $("#position").val(ption);
                $("#accept_id").val(id);
                $("input[name='section_id']").val(section_id);
            },"HTML");
        }); 
        $("#sub").click(function(){
            if($("input[name='is_sign']").val()==1){
                if($("input[name='is_setname']").val()==1){
                    alert("用户不存在");                
                    return false;
                }else if($("input[name='is_setname']").val()==2){
                    alert("无权考核此用户");                
                    return false;
                }
                var username=$("#user").val();
                var quarter =$("#select_1 option:selected").val();

                if(username==""){
                    alert("请填写用户");
                    return false;
                }
                $.post("__CONTROLLER__/ajaxIs_set",{username:username,quarter:quarter},function(data){
                    if(data==1){
                        alert("该用户本季度考核已经存在");
                        return false;
                    }else if(data==2){
                        $("#myForm").submit();
                    }
                });
            }else{
                $("#myForm").submit();
            }            
        });   
    });
    
</script>
